home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJLSR106.ARJ / LDEXP.C < prev    next >
C/C++ Source or Header  |  1992-03-02  |  747b  |  30 lines

  1. /*
  2. ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  3. **
  4. ** This file is distributed under the terms listed in the document
  5. ** "copying.dj", available from DJ Delorie at the address above.
  6. ** A copy of "copying.dj" should accompany this file; if not, a copy
  7. ** should be available from where this file was obtained.  This file
  8. ** may not be distributed without a verbatim copy of "copying.dj".
  9. **
  10. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  11. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. */
  13.  
  14. #include "math.h"
  15.  
  16. double ldexp(double v, int e)
  17. {
  18.   while (e<0)
  19.   {
  20.     v /= 2;
  21.     e++;
  22.   }
  23.   while (e>0)
  24.   {
  25.     v *= 2;
  26.     e--;
  27.   }
  28.   return v;
  29. }
  30.